package mynote;

import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

//注册标签的鼠标监听
public class SignUpListener implements MouseListener {
    private LoginFrame login;
    private JLabel lblSignUp;

    public SignUpListener(LoginFrame login, JLabel lblSignUp) {
        this.login = login;
        this.lblSignUp = lblSignUp;
    }

    @Override
    public void mouseClicked(MouseEvent e) {
        //进入注册界面
        SignUpDialog signUp = new SignUpDialog(login);
        signUp.setVisible(true);
    }

    @Override
    public void mousePressed(MouseEvent e) {

    }

    @Override
    public void mouseReleased(MouseEvent e) {

    }

    @Override
    public void mouseEntered(MouseEvent e) {
        //鼠标移过显示下划线
        lblSignUp.setText("<html><u>注册</u></html>");
        lblSignUp.setForeground(login.lblBtnColor);
    }

    @Override
    public void mouseExited(MouseEvent e) {
        lblSignUp.setText("注册");
        lblSignUp.setForeground(Color.BLACK);
    }
}
